package chapter05

/**
 * Created with IntelliJ IDEA.
 * ClassName: Test01_Fun
 * Package: chapter05
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 *          Date: 2023-06-19
 *          Time: 14:30
 */

object Test01_Fun {
  def main(args: Array[String]): Unit = {
    //定义函数
    def sayHi(name:String):Unit = {
      println("hi " + name)
    }
    sayHi("alice")

    //调用对象方法 这个就是调用外面的sayHi方法
    Test01_Fun.sayHi("haha")

    val result = Test01_Fun.sayHello("XXX")
    println(result)
  }

  def sayHi(name:String):Unit = {
    println("Hi " + name)
  }

  def sayHello(name:String) :String = {
    println("hello " + name)
    return name
  }
}
